package exo1;
import java.util.ArrayList;
import java.util.List;

/**
 * @author fcamps
 *
 * http://docs.oracle.com/javase/tutorial/collections/interfaces/set.html
 *
 */
public class File {

	List<Figure> listFigure = new ArrayList<Figure>();


	class VideException extends Exception{
		public void NombreFigure(){
			System.out.println("Vous essayez d'utiliser une liste vide !");
		}  
	}


	public void addElement(Figure obj)
	{
		listFigure.add(obj);
	}

	public void delElement(int index) throws VideException
	{
		if(listFigure.size() ==0)
			throw new VideException();
		else
			listFigure.remove(index);
	}

	public boolean isEmpty()
	{
		return listFigure.isEmpty();
	}

	public Figure headElement()
	{
		return listFigure.get(listFigure.size());
	}

	public int nbElement()
	{
		return listFigure.size();
	}

	public void listElement()
	{
		for (Object o : listFigure)
			((Figure)o).afficherCaracteristiques();
	}

}
